package com.sl.au.repository;


import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.ChanceKeyMan;

public interface ChanceKeyManRepository extends JpaRepository<ChanceKeyMan,String>{

	@Query(" select c from ChanceKeyMan c where c.saleChance.id=?1 ")
	Page<ChanceKeyMan> findChanceKeyMan(String chanceId, Pageable pageable);
	
	/**
	 * 删除跟chanceId有关的KeyMan
	 * 
	 */
	@Transactional
	@Modifying  
	@Query("delete from ChanceKeyMan c where c.saleChance.id=?1 ")
	public void deleteChanceKeyMan(String chanceId);
}
